package com.truyen.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.truyen.persistence.dao.SearchLoaiTruyenTranhDao;
import com.truyen.persistence.entity.LoaiTruyenTranh;
import com.truyen.persistence.entity.SearchLoaiTruyenTranh;
import com.truyen.persistence.entity.TruyenTranh;
import com.truyen.service.SearchLoaiTruyenTranhService;
import com.truyen.utils.PagingInfo;


@Service
public class SearchLoaiTruyenTranhServiceImpl implements SearchLoaiTruyenTranhService {
	
	@Autowired
	private SearchLoaiTruyenTranhDao searchLoaiTruyenTranhDao;

	@Override
	public void save(SearchLoaiTruyenTranh entity) {
		searchLoaiTruyenTranhDao.save(entity);
	}

	@Override
	public SearchLoaiTruyenTranh findById(Long id) {
		return searchLoaiTruyenTranhDao.findById(id);
	}

	@Override
	public List<SearchLoaiTruyenTranh> getAll() {
		return searchLoaiTruyenTranhDao.findAll();
	}

	@Override
	public SearchLoaiTruyenTranh findByProperty(String column, Object value) {
		List<SearchLoaiTruyenTranh> lst = searchLoaiTruyenTranhDao.findByProperty(column, value);
		return (lst.size()>0)?lst.get(0):null;
	}

	@Override
	public List<SearchLoaiTruyenTranh> getAllLst(String kwSearch, String sort, String sortBy,
			PagingInfo pInfo) {
		return searchLoaiTruyenTranhDao.getAllLst(kwSearch,sort,sortBy,pInfo);
	}

	@Override
	public SearchLoaiTruyenTranh findByLoaiTruyenTranhVTruyenTranh(
			LoaiTruyenTranh loaiTruyenTranh, TruyenTranh comic) {
		return searchLoaiTruyenTranhDao.findByLoaiTruyenTranhVTruyenTranh(loaiTruyenTranh,comic);
	}

	@Override
	public List<SearchLoaiTruyenTranh> getLstByLoaiTruyenTranhWithPaging(
			LoaiTruyenTranh loaiTruyenTranh, String orderBy, PagingInfo pInfo) {
		return searchLoaiTruyenTranhDao.getLstByLoaiTruyenTranhWithPaging(loaiTruyenTranh,orderBy,pInfo);
	}


}
